package org.samoji.GUI;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;

import javax.swing.JButton;
import javax.swing.JPanel;

@SuppressWarnings("serial")
public class SMJTab extends JPanel {
	/*private JFrame _view;
	private JList _list;
	private DefaultListModel _model;*/
	
	private String _tableName;
	
	private JButton _btnInsert = new JButton("Insert");
	private JButton _btnModify = new JButton("Modify");
	private JButton _btnDelete = new JButton("Delete");
	private JButton _btnView = new JButton("View");
	
	public SMJTab(String tableName) {
		_tableName = tableName;
		
		_btnInsert = new JButton("Insert");
		_btnModify = new JButton("Modify");
		_btnDelete = new JButton("Delete");
		_btnView = new JButton("View");
		
		_btnInsert.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				try {
					new InsertNew(_tableName).setVisible(true);
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}									
			}
		});
		
		_btnModify.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				
			}
		});
		
		_btnDelete.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				
			}
		});
		
		_btnView.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				
			}
		});
		
		// this.setLayout(new GridLayout(2, 2));
		
		add(_btnInsert);
		add(_btnModify);
		add(_btnDelete);
		add(_btnView);
	}
}
